﻿<UserControl x:Class="ScrumFactory.Team.PendingMemberships"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             
             xmlns:props="clr-namespace:ScrumFactory.Team.Properties"
             
             xmlns:SF="clr-namespace:ScrumFactory;assembly=ScrumFactory"             
             xmlns:SF_Helpers="clr-namespace:ScrumFactory.Windows.Helpers;assembly=ScrumFactory.Windows.Helpers"
             xmlns:SF_Comp="clr-namespace:ScrumFactory.Composition;assembly=ScrumFactory.Composition" 
             
             x:Name="thisView"
             
             d:DesignHeight="300" d:DesignWidth="300">
    
                        <StackPanel Orientation="Vertical" >
        <TextBlock Text="{x:Static props:Resources.Pending_memberships}" Style="{StaticResource TitleTextBlock}"  Margin="0,0,0,5"/>
      
                            
                            <ListBox
                                ItemsSource="{Binding PendingProjects}">
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <Grid>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="Auto"/>
                                                <ColumnDefinition Width="*"/>
                                                <ColumnDefinition Width="Auto"/>
                                            </Grid.ColumnDefinitions>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="Auto"/>
                                                <RowDefinition Height="Auto"/>
                                            </Grid.RowDefinitions>
                                            
                                            <ComboBox x:Name="hoursDay"
                                                      Grid.Column="0" Grid.RowSpan="2"
                                                      SelectedValue="{Binding Memberships[0].DayAllocation}"
                                                      VerticalAlignment="Top"
                                                      Style="{StaticResource MemberAllocationComboBox}"/>

                                            <TextBlock Grid.Column="1"  Grid.Row="0" Margin="10,0,0,5">
                                                <TextBlock Style="{StaticResource dayAllocationTextBlock}" FontWeight="Bold" DataContext="{Binding SelectedValue, ElementName=hoursDay}"/>
                                                <TextBlock Text="{x:Static props:Resources.engaged_as}"/>
                                                <TextBlock FontWeight="Bold" Text="{Binding Memberships[0].Role.RoleName}"/>
                                                <TextBlock Text="{x:Static props:Resources.engaged_at_project}"/>
                                                <TextBlock FontWeight="Bold" Text="{Binding ClientName, StringFormat='{}{0} - '}"/>
                                                <TextBlock FontWeight="Bold" Text="{Binding ProjectName}"/>                                                
                                            </TextBlock>

                                            <Button
                                                Grid.Column="1" Grid.Row="1" Margin="10,0,10,5"      
                                                Command="{Binding Model.EngageCommand, ElementName=thisView}"
                                                CommandParameter="{Binding  Memberships[0]}"
                                                Style="{StaticResource AlertButton}"
                                                VerticalAlignment="Center" HorizontalAlignment="Left"
                                                Content="{x:Static props:Resources.Engage}"/>

                                            <Button
                                                Grid.Column="1" Grid.Row="1" Margin="10,0,10,5"
                                                Command="{Binding Model.RefuseCommand, ElementName=thisView}"
                                                CommandParameter="{Binding  Memberships[0]}"
                                                Style="{StaticResource AlertButton}"
                                                VerticalAlignment="Center" HorizontalAlignment="Right"
                                                Content="{x:Static props:Resources.Refuse}"/>

                                        </Grid>

                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>
        <StackPanel.Style>
            <Style TargetType="StackPanel">
                <Style.Triggers>
                    <DataTrigger Binding="{Binding IsVisible}" Value="False">
                        <Setter Property="Visibility" Value="Collapsed"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>
        </StackPanel.Style>
    </StackPanel>
                        

</UserControl>
